
/* Log format? */
#if 0
entry {
        level : LOG_LEVEL
        action : DOSOMETHING (maybe give the action an id?)
        /* variable information based on action type */
        note : some notes about the actions.  for a client level log entry this
        is all that will exist.
}

result {
        level : LOG_LEVEL
        action : action id? name?
        result : success/fail/whatever
        note : why it failed
}

#endif

#define LOG_FILE_PATHNAME_TEMPLATE "pkg-log-%s-XXXXXX"

int
pkg_log_start(struct pkg_logger *l, const char *name)
{
        char *pathname;
        char tmp[PATH_MAX];

        if (l->start != 0) {
                PKG_CLIENT_CRASH(__func__, "Trying to start an initialized"
                " logger.");
        }
        TAILQ_INIT(&l->head);
        strcpy(tmp, name);
        mktemp(tmp);
        l->log_fp = fopen(tmp);
        if (l->log_fp == NULL) {
                return (PKG_FATAL);
        }
        return (PKG_OK);
}


/* The default logger callback for libpkg. */
void
pkg_log(struct pkg_logger *l, const char *fmt, ...)
{
        int r;
        va_list args;

        /* Generates a log_entry object, places it in the logger queue, then
         * writes to disk is the logger wants it to.
         */
}

int
pkg_logger_piggy_back(struct pkg_logger *l, struct pkg_logger *p)
{
        /* piggy back on logger on another. */
}
